package za.org.meraka.cair.ontorepair;

import org.protege.editor.owl.OWLEditorKit;
import org.protege.editor.owl.ui.renderer.OWLCellRenderer;

import javax.swing.*;
import java.awt.*;

public class JustificationListCellRenderer extends OWLCellRenderer {
	
    public JustificationListCellRenderer(OWLEditorKit owlEditorKit) {
        super(owlEditorKit);
    }

    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                                                  boolean cellHasFocus) {
        Object renderableValue = value;
        if (value instanceof JustificationListItem) {
        	JustificationListItem item = (JustificationListItem) value;
            renderableValue = item.getOWLObject();
        }
        setPreferredWidth(list.getWidth());
        return super.getListCellRendererComponent(list, renderableValue, index, isSelected, cellHasFocus);
    }
}
